"use strict";
cc._RF.push(module, '443c0HZOJxHiadWuJBZmIbO', 'DebugUtil');
// eazax-ccc/utils/DebugUtil.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
 * 调试工具
 * @see DebugUtil.ts https://gitee.com/ifaswind/eazax-ccc/blob/master/utils/TimeUtil.ts
 */
var DebugUtil = /** @class */ (function () {
    function DebugUtil() {
    }
    /**
     * 打出光彩夺目的日志（黑蓝白配色）
     * @param title 标题
     * @param msg 信息
     */
    DebugUtil.log = function (title, msg) {
        if (msg) {
            console.log("%c " + title + " %c " + msg + " ", 'background: #35495E;padding: 1px;border-radius: 2px 0 0 2px;color: #fff;', 'background: #409EFF;padding: 1px;border-radius: 0 2px 2px 0;color: #fff;');
        }
        else {
            console.log("%c " + title + " ", 'background: #409EFF;padding: 1px;border-radius: 0 2px 2px 0;color: #fff;');
        }
    };
    /**
     * 展示动态图集
     * @param status 状态
     */
    DebugUtil.showDynamicAtlas = function (status) {
        if (status === void 0) { status = true; }
        return cc.dynamicAtlasManager.showDebug(status);
    };
    /**
     * 展示左下角的统计面板
     * @param status 状态
     */
    DebugUtil.showStats = function (status) {
        if (status === void 0) { status = true; }
        cc.debug.setDisplayStats(status);
    };
    /**
     * 更改统计面板的文本颜色
     * @param font 文本颜色
     */
    DebugUtil.setStatsColor = function (font, background) {
        if (font === void 0) { font = cc.Color.WHITE; }
        if (background === void 0) { background = cc.color(0, 0, 0, 150); }
        var profiler = cc.find('PROFILER-NODE');
        if (!profiler)
            return cc.warn('未找到统计面板节点！');
        // 文字
        profiler.children.forEach(function (node) { return node.color = font; });
        // 背景
        var node = profiler.getChildByName('BACKGROUND');
        if (!node) {
            node = new cc.Node('BACKGROUND');
            profiler.addChild(node, cc.macro.MIN_ZINDEX);
            node.setContentSize(profiler.getBoundingBoxToWorld());
            node.setPosition(0, 0);
        }
        var graphics = node.getComponent(cc.Graphics) || node.addComponent(cc.Graphics);
        graphics.clear();
        graphics.rect(-5, 12.5, node.width + 10, node.height - 10);
        graphics.fillColor = background;
        graphics.fill();
    };
    /**
     * 上一次渲染帧所提交的渲染批次总数
     */
    DebugUtil.getDrawCalls = function () {
        return cc.renderer.drawCalls;
    };
    return DebugUtil;
}());
exports.default = DebugUtil;
window['eazax'] && (window['eazax']['debug'] = DebugUtil);

cc._RF.pop();